package org.lsy.controller;

import org.apache.dubbo.config.annotation.Reference;
import org.lsy.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author SHIYUAN
 * @version 1.0
 */
@RestController
@RequestMapping("/api/code")
public class CodeController {

    @Autowired
    private CodeService codeService;

    @GetMapping("/create/{email}")

    public Boolean create(@PathVariable String email) {
        return codeService.createCode(email);
    }

    @GetMapping("/validate/{email}/{code}")
    public Integer validate(@PathVariable String email, @PathVariable String code) {
        return codeService.validateCode(email, code);
    }
}
